﻿using Hpt.Device.Sample.Dto;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;

namespace Hpt.Device.Sample.Controllers
{
    [ApiVersion("2.0")]
    //[Route("api/[controller]")]
    [Route("hpt/v{version:apiVersion}/Accounts")]
    [ApiController]
    [AllowAnonymous]
    public class DevicesV2Controller : ControllerBase
    {
        /// <summary>
        /// 获取人脸下发任务列表
        /// </summary>
        /// <param name="clientNos"></param>
        /// <param name="size"></param>
        /// <returns></returns>  FaceListRequest request
        [HttpGet, Route("FaceSyncTasks")]
        [ProducesDefaultResponseType(typeof(ClientFaceSyncTaskResponse))]
        public async Task<IActionResult> ClientFaceList(string clientNos, int? size = 1000)
        {
            return await Task.FromResult(Ok(new ClientFaceSyncTaskResponse
            {
                Models = new ClientFaceSyncTaskResponse.ClientFaceSyncTaskModel[]
                {
                    new()
                    {
                        AccountInfos = Array.Empty<ClientFaceSyncTaskResponse.ClientFaceSyncTaskModel.AccountInfo>(), ClientID = 9001, Connection = new ClientFaceSyncTaskResponse.ClientFaceSyncTaskModel.ClientConnection
                        {
                            TerminalNo =1
                        }
                    }
                }
            }));
        }

        [HttpPost, Route("FaceSyncTasks")]
        [ProducesDefaultResponseType(typeof(FaceSyncStatusResponse))]
        public async Task<IActionResult> ClientFaceUpdateStatus([FromBody] FaceSyncStatusRequest request)
        {
            return await Task.FromResult(Ok(DeviceResponseBaseV1.Success));
        }

        /// <summary>
        /// 上传现场识别照片
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [AllowAnonymous]
        [HttpPost, Route("UploadIdentifyImage")]
        [ProducesDefaultResponseType(typeof(UploadIdentifyImageResponse))]
        public async Task<IActionResult> UploadIdentifyFaceImage(UploadIdentifyImageRequest request)
        {
            return await Task.FromResult(Ok(DeviceResponseBaseV1.Success));
        }
    }
}